/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "JOURNAUX")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Journaux.findAll", query = "SELECT j FROM Journaux j"),
    @NamedQuery(name = "Journaux.findByNumjo", query = "SELECT j FROM Journaux j WHERE j.numjo = :numjo"),
    @NamedQuery(name = "Journaux.findByCodejo", query = "SELECT j FROM Journaux j WHERE j.codejo = :codejo"),
    @NamedQuery(name = "Journaux.findByIntitulejo", query = "SELECT j FROM Journaux j WHERE j.intitulejo = :intitulejo")})
public class Journaux implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NUMJO")
    private Integer numjo;
    @Basic(optional = false)
    @Column(name = "CODEJO")
    private String codejo;
    @Basic(optional = false)
    @Column(name = "INTITULEJO")
    private String intitulejo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numjo")
    private Collection<Ecriturec> ecriturecCollection;
    @JoinColumn(name = "TYPEJO", referencedColumnName = "ID_TYPEJO")
    @ManyToOne(optional = false)
    private Typejo typejo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numjo")
    private Collection<Joperiode> joperiodeCollection;

    public Journaux() {
    }

    public Journaux(Integer numjo) {
        this.numjo = numjo;
    }

    public Journaux(Integer numjo, String codejo, String intitulejo) {
        this.numjo = numjo;
        this.codejo = codejo;
        this.intitulejo = intitulejo;
    }

    public Journaux(Integer numjo, String codejo, String intitulejo,Typejo typejo) {
        this.numjo = numjo;
        this.codejo = codejo;
        this.intitulejo = intitulejo;
        this.typejo = typejo;
    }
    
    public Integer getNumjo() {
        return numjo;
    }

    public void setNumjo(Integer numjo) {
        this.numjo = numjo;
    }

    public String getCodejo() {
        return codejo;
    }

    public void setCodejo(String codejo) {
        this.codejo = codejo;
    }

    public String getIntitulejo() {
        return intitulejo;
    }

    public void setIntitulejo(String intitulejo) {
        this.intitulejo = intitulejo;
    }

    @XmlTransient
    public Collection<Ecriturec> getEcriturecCollection() {
        return ecriturecCollection;
    }

    public void setEcriturecCollection(Collection<Ecriturec> ecriturecCollection) {
        this.ecriturecCollection = ecriturecCollection;
    }

    public Typejo getTypejo() {
        return typejo;
    }

    public void setTypejo(Typejo typejo) {
        this.typejo = typejo;
    }

    @XmlTransient
    public Collection<Joperiode> getJoperiodeCollection() {
        return joperiodeCollection;
    }

    public void setJoperiodeCollection(Collection<Joperiode> joperiodeCollection) {
        this.joperiodeCollection = joperiodeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numjo != null ? numjo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Journaux)) {
            return false;
        }
        Journaux other = (Journaux) object;
        if ((this.numjo == null && other.numjo != null) || (this.numjo != null && !this.numjo.equals(other.numjo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Journaux[ numjo=" + numjo + " ]";
    }
    
}
